package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysHeatFeeMapper;
import com.ruoyi.system.domain.SysHeatFee;
import com.ruoyi.system.service.ISysHeatFeeService;

/**
 * 费用统计Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-21
 */
@Service
public class SysHeatFeeServiceImpl implements ISysHeatFeeService 
{
    @Autowired
    private SysHeatFeeMapper sysHeatFeeMapper;

    /**
     * 查询费用统计
     * 
     * @param feeId 费用统计主键
     * @return 费用统计
     */
    @Override
    public SysHeatFee selectSysHeatFeeByFeeId(Long feeId)
    {
        return sysHeatFeeMapper.selectSysHeatFeeByFeeId(feeId);
    }

    /**
     * 获取最后一条设备费用统计
     *
     * @param deviceId 设备id
     * @return 费用统计
     */
    @Override
    public SysHeatFee selectLastSysHeatFeeByDeviceId(Long deviceId){
        return sysHeatFeeMapper.selectLastSysHeatFeeByDeviceId(deviceId);
    }

    /**
     * 查询费用统计列表
     * 
     * @param sysHeatFee 费用统计
     * @return 费用统计
     */
    @Override
    public List<SysHeatFee> selectSysHeatFeeList(SysHeatFee sysHeatFee)
    {
        return sysHeatFeeMapper.selectSysHeatFeeList(sysHeatFee);
    }

    /**
     * 新增费用统计
     * 
     * @param sysHeatFee 费用统计
     * @return 结果
     */
    @Override
    public int insertSysHeatFee(SysHeatFee sysHeatFee)
    {
        sysHeatFee.setCreateTime(DateUtils.getNowDate());
        return sysHeatFeeMapper.insertSysHeatFee(sysHeatFee);
    }

    /**
     * 修改费用统计
     * 
     * @param sysHeatFee 费用统计
     * @return 结果
     */
    @Override
    public int updateSysHeatFee(SysHeatFee sysHeatFee)
    {
        return sysHeatFeeMapper.updateSysHeatFee(sysHeatFee);
    }

    /**
     * 批量删除费用统计
     * 
     * @param feeIds 需要删除的费用统计主键
     * @return 结果
     */
    @Override
    public int deleteSysHeatFeeByFeeIds(Long[] feeIds)
    {
        return sysHeatFeeMapper.deleteSysHeatFeeByFeeIds(feeIds);
    }

    /**
     * 删除费用统计信息
     * 
     * @param feeId 费用统计主键
     * @return 结果
     */
    @Override
    public int deleteSysHeatFeeByFeeId(Long feeId)
    {
        return sysHeatFeeMapper.deleteSysHeatFeeByFeeId(feeId);
    }

    /**
     * 查看最近三天热费不为0的数量
     * @param deviceCode
     * @return
     */
    @Override
    public int checkFeeChange(String deviceCode){
        return sysHeatFeeMapper.checkFeeChange(deviceCode);
    }
}
